//
//  ReportOrderVC.m
//  MyProject
//
//  Created by jiaming yan on 2018/3/24.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "ReportOrderVC.h"
#import "IQTextView.h"

@interface ReportOrderVC ()
@property (weak, nonatomic) IBOutlet IQTextView *desTextView;

@property (weak, nonatomic) IBOutlet UIButton *button1;
@property (weak, nonatomic) IBOutlet UIButton *button2;
@property (weak, nonatomic) IBOutlet UIButton *button3;
@property (weak, nonatomic) IBOutlet UIButton *button4;

@property (weak, nonatomic) IBOutlet UIImageView *imageView1;
@property (weak, nonatomic) IBOutlet UIImageView *imageView2;
@property (weak, nonatomic) IBOutlet UIImageView *imageView3;
@property (weak, nonatomic) IBOutlet UIImageView *imageView4;

@property(nonatomic,copy) NSString *reason;
@end

@implementation ReportOrderVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"请选择投诉原因";
    self.desTextView.placeholder = @"请描述问题详情，以便对方了解实际情况。";
    self.reason = @"对方没有出现";
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)typeButtonClick:(UIButton *)sender {
    if (sender == self.button1) {
        self.imageView1.hidden = NO;
        self.imageView2.hidden = YES;
        self.imageView3.hidden = YES;
        self.imageView4.hidden = YES;
        self.reason = @"对方没有出现";
    }else if (sender == self.button2) {
        self.imageView1.hidden = YES;
        self.imageView2.hidden = NO;
        self.imageView3.hidden = YES;
        self.imageView4.hidden = YES;
        self.reason = @"提问都没有回答";
    }else if (sender == self.button3) {
        self.imageView1.hidden = YES;
        self.imageView2.hidden = YES;
        self.imageView3.hidden = NO;
        self.imageView4.hidden = YES;
        self.reason = @"语言／人身攻击";
    }else if (sender == self.button4) {
        self.imageView1.hidden = YES;
        self.imageView2.hidden = YES;
        self.imageView3.hidden = YES;
        self.imageView4.hidden = NO;
        self.reason = @"散布广告等违规行为";
    }
}

- (IBAction)submitClick:(id)sender {

    if (self.desTextView.text.length == 0   ) {
        ALERT_VIEW(@"请输入详细描述");
        return;
    }
    __weak typeof(self) weakSelf = self;
    [self showProgressWithView:self.view animated:YES];
    [YJMSendRequest postDataWithParameters:@{@"serviceId":self.serviceId,@"reason":self.reason,@"remark":self.desTextView.text,@"serviceType":self.serviceType,@"messageLog":self.reportStr} url:@"service/complain" result:^(NSDictionary *result, NSError *error) {
        result = [CommonUtils decryptDicWithResult:result];
        [weakSelf hideProgress:self.view animated:YES];
        if([result[@"result"] integerValue] == 1)
        {
            
            [self.navigationController popViewControllerAnimated:YES];
            ALERT_VIEW(@"举报完成，等待管理员处理！");
            
        }else{
            
            
            [CommonUtils showToast:[result objectForKey:@"msg"]];
        }
        
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
